/********试题**********/
var Question = (function(){
	function Question(){
		this.title = null;//试题
		this.type = "single";//题目类型，单选single、多选multi
		this.options = [];//选项
		this.labelNum = 65;//A的ASICC码
		this.boxPrefix = "question_option_";//选项的前缀
		this.scorePrefix = "question_option_score_";//试题分数前缀
		this.examinationPaperId = null;//试卷ID
		this.info = null;
	}

	/**
	 * 添加选项
	 */
	Question.prototype.addOption = function(option) {
		this.options.push(option);
		return this;
	}

	/**
	 * 设置试题额外信息
	 */
	Question.prototype.setInfo = function(info) {
		this.info = info;
	}

    /**
	 * 设置试卷Id
     * @param examinationPaperId
     * @returns {Question}
     */
	Question.prototype.setPaperId = function(examinationPaperId){
		this.examinationPaperId = examinationPaperId;
		return this;
	}

	/**
	 * 设置题目类型
	 * type:
	 * single(单选)
	 * multi（多选）
	 */
	Question.prototype.setType = function(type) {
		this.type = type;
        return this;
	}
    
    /**
     * 设置题目
     */
	Question.prototype.setTitle = function(title) {
		this.title = title;
        return this;
	}

	Question.prototype.setOptions = function(options) {
		this.options = options;
		return this;
	}
    /**
	 * 生成标签
     * @returns {string}
     */
	Question.prototype.generateLabel = function(){
		return String.fromCharCode(this.labelNum++);
	}

    /**
	 * 重置题目选项
     */
    Question.prototype.resetQuestion = function () {
		this.options.splice(0,this.options.length);//清空选项
        this.labelNum = 65;// 重置标签代码为A
    }
	return Question;
}());

/*******选项**********/
var Option = (function(){
	function Option(){
		this.id = null;
		this.label = null;
		this.content = "";
		this.score = 0;
        this.scoreId = null;
	}


	Option.prototype.setId = function(id) {
		this.id = id;
		return this;
	}

	Option.prototype.setScoreId = function(scoreId) {
		this.scoreId = scoreId;
		return this;
	}
	Option.prototype.setLabel = function(label) {
		this.label = label;
		return this;
	}

	Option.prototype.setContent = function(content) {
		this.content = content;
		return this;
	}

	Option.prototype.setScore = function(score) {
		this.score = score;
		return this;
	}
	
	return Option;
}());